package com.humanmonth.home.component.header
{
	import flash.events.Event;
	import flash.events.MouseEvent;
	
	import mx.core.Application;
	import mx.events.FlexEvent;
	
	public class HeaderAs extends header
	{
		public function HeaderAs()
		{
			super();
			this.addEventListener(FlexEvent.CREATION_COMPLETE,myInit);
		}
		
		private function myInit(event:Event):void{
		this.initName();
		this.initState();
		}
		
		/**
		 *初始化 
		 * 
		 */
		private function initName():void{
		this.myTree.buttonName.text="树形图";
		this.portal.buttonName.text="首页";
		this.him.buttonName.text="聊天HIM";
		this.contact.buttonName.text="联系方式";
		this.msg.buttonName.text="留言";
		this.homepage.buttonName.text="主页";
		this.report.buttonName.text="报表";
		this.signature.buttonName.text="手写签名";
		}
		
		/**
		 *初始化关于状态的事件 
		 */
		private function initState():void{
		this.myTree.addEventListener(MouseEvent.CLICK,toHTreeState);
		this.portal.addEventListener(MouseEvent.CLICK,toPortalState);
		this.contact.addEventListener(MouseEvent.CLICK,toContact);
		this.homepage.addEventListener(MouseEvent.CLICK,toHomePage);
		this.him.addEventListener(MouseEvent.CLICK,toHIM);
		this.msg.addEventListener(MouseEvent.CLICK,toMsg);
		this.signature.addEventListener(MouseEvent.CLICK,toSignature);
		this.report.addEventListener(MouseEvent.CLICK,toReport);
		}
		
		public function toReport(event:Event):void{
		    Application.application.currentState="report";
		}
		
		private function toSignature(event:Event):void{
			Application.application.currentState="signature";
		}
		
		private function toMsg(event:Event):void{
			Application.application.currentState="msg";
		}
		
		private function toHIM(event:Event):void{
		Application.application.currentState="HIM";
		}
		
		private function toContact(event:Event):void{
		Application.application.currentState="Contact";
		}
		
		private function toHomePage(event:Event):void{
		Application.application.currentState="HPage";
		}
		
		public function toHTreeState(event:Event):void{
		Application.application.currentState="HTree";		
		}
		
		private function toPortalState(event:Event):void{
		Application.application.currentState="Portal";
		}
		
	}
}